package day10;

public class Homework2 {
int n=1;
int a=1;
int c=65;
int count;
int count2;
    public synchronized void printA(){
        if(n==1){
            System.out.print(a++);
            System.out.print(a++);
            count++;
            n=2;
        }
    }
    public synchronized void printB(){
        if(n==2){
            System.out.print((char)(c++));
            count2++;
            n=1;
        }
    }
    public static void main(String[] args) {
        Homework2 h = new Homework2();
        new Thread(()->{
        while (h.count<26){
             h.printA();
         }
        },"A").start();
        new Thread(()->{
        while (h.count<26){
             h.printB();
         }
        },"B").start();
    }
}
